#include"head.h"
int cmd_analyse(int socket_fd,train_t command_data,char*cur_path)
{
  //ls 0
  //cd 1
  //pwd 2
  //download 3
  //upload 4
  //rm 5
  //cdir 6
  //default 

  //通过传入的command_data中存储的操作信息，
  //用switch-case结构转入对应的工作函数
  //command_data.op=ls;
  //memset(command_data.path,0,sizeof(command_data));
  send(socket_fd,&command_data,sizeof(command_data),MSG_NOSIGNAL);
  switch(command_data.op)
      
  {
    //服务器维护路径
    case ls:
        client_ls(socket_fd);
        break;
    case cd:
        client_cd(socket_fd,cur_path,command_data.path);
        break;
    case pwd:
        client_pwd(cur_path);
        break;
    case download:
        client_download(socket_fd,command_data.path);
        printf("download end\n");
        break;
    case upload:
        client_upload(socket_fd,command_data.path);
        printf("upload end\n");
        break;
    case rm:
        client_rm(socket_fd,command_data.path);
        break;
    case cdir:
        client_cdir(socket_fd,command_data.path);
        break;
     default:
        printf("do not get command\n");
        break;
  }
  return 0;
}
